home *** CD-ROM | disk | FTP | other *** search
/ CYBER.XPO.95 / CYBER.XPO.95 (Arsenal Computer).ISO / popreq / amiga1 / a1000hks.lha / ykick / reset.S < prev    next >
Text File  |  1993-02-28  |  2KB  |  89 lines

  1. *
  2. *  This code is Copyright by Bernd Harder.
  3. *  Slightly modified by Tobias Ferber on 23.02.1993
  4. *
  5.  
  6.   SECTION code
  7.  
  8.   XDEF _reset
  9.  
  10. _SysBase         EQU 4
  11. _LVODisable      EQU -120 
  12. _LVOForbid       EQU -132
  13. _LVOCopyMem      EQU -624
  14.  
  15. _reset:
  16.   move.l 4(sp),src       ;current location of complete kickfile
  17.   move.l 8(sp),dst       ;where to copy lower 256k bank
  18.  
  19.   move.l (_SysBase).W,A6
  20.   jsr _LVODisable(a6)
  21.   jsr _LVOForbid(a6)
  22.  
  23.   ; change the ColdCapture vector
  24.  
  25.   lea.l coldice,a0
  26.   move.l a0,42(a6)       ;SysBase->ColdCapture
  27.  
  28.   ; we must adjust the ChkSum after changing this vector
  29.  
  30.   lea $22(a6),a0         ;&SysBase->SoftVer (version number)
  31.   moveq.l #$16,d0        ;summation over $16 words
  32.   moveq.l #0,d1
  33. \chksum:
  34.   add.w (a0)+,d1
  35.   dbra d0,\chksum
  36.   not.w d1
  37.   move.w d1,$52(a6)      ;SysBase->ChkSum
  38.  
  39.   ; become Supervisor to change the WOM (BootROM visible at $f80000)
  40.  
  41.   lea \trap,a0
  42.   move.l a0,$80          ;MC680x0 TRAP0 vector
  43.   trap #0
  44.  
  45.   CNOP 0,4  ;IMPORTANT! Longword align!
  46.  
  47. \trap:
  48.   move.l src,a0
  49.   move.l dst,a1
  50.   move.l #$40000,d0      ;move a complete kickstart to dst
  51.   jsr _LVOCopyMem(a6)
  52.  
  53. coldreboot:
  54.   lea $1000000,a0   ;End of Kickstart ROM
  55.   sub.l -$14,a0     ;Offset from end of ROM to Kickstart size
  56.   move.l 4(a0),a0   ;Get Initial Program Counter
  57.   subq #2,a0        ;now points to second RESET
  58.   reset             ;first RESET instruction      \  MUST share
  59.   jmp (a0)          ;CPU Prefetch executes this   /  one longword
  60.  
  61. ;-------------------------------------------------ColdCapture---------------
  62.  
  63.   CNOP 0,4
  64.  
  65.   ; ColdCapture routine (kickstart part 2 --> WOM)
  66.  
  67. coldice:
  68.   move.l src,a0          ;we'll find a complete kickstart here
  69.   adda.l #$40000,a0      ;look at the 2nd part (upper 256k)
  70.   lea.l    $fc0000,a1
  71. \womit:
  72.   move.l (a0)+,(a1)+
  73.   cmp.l #$1000000,a1
  74.   bne.s \womit
  75.   move.l #0,4
  76.   move.w #0,$f80000      ;protect the A1000 bootrom
  77.   lea $fc0004,a0
  78.   subq.l #2,a0
  79.   jmp (a0)               ;jump into kickstart
  80.  
  81. ;---------------------------------------------------------------------------
  82.  
  83. src:
  84.   dc.l 0
  85. dst:
  86.   dc.l 0
  87.  
  88.   END
  89.